<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" session="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="0">
    <title>住户管理</title>

    <link href="${pageContext.request.contextPath}/static/css/common.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/css/bootstrap.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/font-awesome-4.3.0/css/font-awesome.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/css/select2.min.css"
          rel="stylesheet">
    <!-- jqgrid-->
    <link href="${pageContext.request.contextPath}/static/plugins/jqGrid/css/custom.ui.jqgrid.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/layer/skin/layer.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/jqGrid/css/style.css" rel="stylesheet">

    <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/jquery.form.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/common.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/jqGrid/js/i18n/grid.locale-cn.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/jqGrid/js/minified/jquery.jqGrid.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/layer/layer.js" type="text/javascript"></script>
	<script src="${pageContext.request.contextPath}/static/js/global.js"></script>
	<script src="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/js/select2.min.js"></script>
	<script type="text/javascript"
            src="${pageContext.request.contextPath}/static/plugins/My97DatePicker/WdatePicker.js"></script>
    <style type="text/css">
        .main h5 a {
            position: absolute;
            right: 20px;
            font-size: 14px;
            bottom: 0px;
            display: inline-block;
            padding: 5px;
        }

        .table_list tbody tr {
            height: 35px;
            text-align: center;
        }
		.lt{
			float:left;
			
		}
		.panel{
			*+margin-left:270px;
			
		}
		.panel-body label{
			text-align:center;
			*+width:200px;
		}
		.jqGrid_wrapper{
			*+margin-left:270px;
			
		}
		ul li{
			
			*line-height:40px;
			
			padding-left:20px;
		}
		ul li a,ul li a:hover{
			*color:#fff;
		}
		.form-group{
			overflow:hidden;
		}
		.form-control{
			*+padding:0;
			*+width:90%;
			
		}
		.col-md-1{
			padding:0;
		}
		.btn{
				width:70px\0;
				margin-right:10px\0;
				*+width:70px;
				*+margin-right:10px;
				line-height:14px !important;
			}
		#query,#resetForm{
			width:100px;
		}
		#jqgh_jqGrid_cb{*+text-align:center;}
		.jqgrid-rownum{*+width:0;}
		#cBuildingId,#utype{color:#aaa;outline:none;padding:2px 0px 2px 4px;}
		.panel-body .form-lable{width:60px\9;*+width:60px;}
		#select2-communityId-container{width:106px;}
		
    </style>
</head>
<body view="menu-item-4142">
<jsp:include page="../../top.jsp"></jsp:include>
<div class="right">
 	<div class="wrapper">
        <div class="panel panel-default">
            <div class="panel-heading">
                <span><strong>查询条件</strong></span>

                <div class="ibox-tools">
                    <a class="collapse-link"> <i class="fa fa-chevron-down"></i></a>
                    <a class="collapse-link  d-n"> <i class="fa fa-chevron-up"></i></a>
                </div>
            </div>
            <div class="panel-body">
                <form class="form-horizontal">
					<c:if test="${userRole == 1 || userRole == 2 || userRole == 21}">
						<div class="form-group">
							<label class="selectlabe1 col-md-1 form-lable lt">公司名称：</label>
							<div class="selectdivs col-md-3 lt">
								<select name="agtCode" id="agtCode" class="form-control col-md-1"></select>
							</div>
							
							<label class="selectlabe2 col-md-1 form-lable lt" style="width: 90px;">小区名称：</label>
							<div class="selectdivs col-md-3 lt" >
								<select name="communityId" id="communityId" class="form-control col-md-1"></select>
							</div>
							<label class="selectlabe2 col-md-1 form-lable lt" >所属区域：</label>
							<div id="region" class="col-md-3 lt" style="padding-left: 0px;">
								<script type="text/javascript">
									loadCity();
								</script>
							</div>
						</div>
					</c:if>
					<c:if test="${userRole == 3 || userRole == 4}">
						 <div class="form-group">
							<c:if test="${rLevel == 3 || rLevel == 4}">
								<label class="col-md-1 form-lable lt" style="width: 110px;">主用户：</label>
							</c:if>
							<c:if test="${rLevel != 3 && rLevel != 4}">
								<label class="col-md-1 form-lable lt" style="width: 110px;">小区名称：</label>
							</c:if>
							<div class="col-md-3 lt" style="padding-left:0px;width: 120px;">
								<label>
									<span class="arrow"></span>
									<select name="communityId" id="communityId" class="form-control col-md-1"></select>
								</label>
							</div>
							<label class="col-md-1 form-lable lt" style="width: 100px;">所属区域：</label>
							<div id="region" class="col-md-3 lt" style="width: 147px;padding-left: 0px;">
							<script type="text/javascript">
							   loadCity();
							</script>
							</div>
							<c:if test="${rLevel != 3 && rLevel != 4}">
							<label class="col-md-1 form-lable lt" style="text:center;" >昵称：</label>
							<div class="selectdivs col-md-3 lt"  style="padding-left:0px;width: 170px;">
								<input id="nickName" name="nickName" type="text" class="form-control"/>
							</div>
							</c:if>
						</div>
						<div class="form-group">
						   
							<label class="col-md-1 form-lable lt" style="width: 110px;">手机号：</label>
							<div class="col-md-3 lt" style="padding-left:0px;width: 120px;">
								<input id="auTel" name="auTel" type="text" class="form-control"/>
							</div>
							<c:if test="${rLevel == 3 || rLevel == 4}">
							<label class="col-md-1 form-lable lt" style="width: 100px;">用户：</label>
							</c:if>
							<c:if test="${rLevel != 3 && rLevel != 4}">
							<label class="col-md-1 form-lable lt" style="width: 100px;">住户：</label>
							</c:if>
							<div class="col-md-3 lt"  style="padding-left:0px;width: 147px;">
								<input id="auName" name="auName" type="text" class="form-control"/>
							</div>   
							<div class="col-md-1 lt form-action" style="margin-left: 51px;">
							<button class="btn btn-success form-control lt" id="query">查询</button>
							</div>
							<div class="col-md-1 form-action">
							<button class="btn btn-success form-control lt" id="resetForm">清空</button>
							</div>
						</div>
					</c:if>
					<c:if test="${userRole == 1 || userRole == 2 || userRole == 21 || userRole == 5 || userRole == 6}">
							<div class="form-group" >
								<label class="selectlabe1 col-md-1 form-lable lt" style="letter-spacing:3px;">楼栋：</label>
								<div class="selectdivs col-md-3 lt">
									<select name="cBuildingId" id="cBuildingId" class="form-control col-md-1"></select>
								</div>
								
								<label class="selectlabe2 col-md-1 lt form-lable" style="width: 90px;">单元：</label>
								<div class="selectdivs col-md-3 lt" >
									<span class="arrow"></span>
									<select name="unitId" id="unitId" class="form-control col-md-1">
									
									</select>
								</div>
								<label class="selectlabe2 lt col-md-1 form-lable">房间号：</label>
								<div class="selectdivs col-md-3 lt" >
									<input id="roomNo" name="roomNo" type="text" class="form-control"/>
								</div>		         		
							</div>
						
						<div class="form-group">
							<label class="col-md-1 form-lable lt" style="width: 100px;">姓名：</label>
							<div class="selectdivs col-md-3 lt"  style="padding-left:0px;width: 170px;">
								<input id="auName" name="auName" type="text" class="form-control"/>
							</div>
							<label class="selectlabe2 lt col-md-1 form-lable">状&nbsp;&nbsp;态：</label>
							<div class="selectdivs col-md-3 lt">
								<select name="utype" id="utype" class="form-control col-md-1 lt">
									<option value="">请选择</option>
									<option value="1">主业主</option>
									<option value="2">主租客</option>
									<option value="3">住户</option>
									<option value="4">租客</option>                                
								</select>
							</div>
						   <label class="selectlabe2 col-md-1 form-lable lt" style="width: 110px;">手机号：</label>
							<div class="selectdivs col-md-3 lt" style="padding-left:0px;width: 210px;">
								<input id="auTel" name="auTel" type="text" class="form-control"/>
							</div>
								
							<div class="col-md-1 form-action lt" >
							<button class="btn btn-success form-control" id="query">查询</button>
							</div>
							<div class="col-md-1 form-action lt">
							<button class="btn btn-success form-control" id="resetForm">清空</button>
							</div>
						</div>
					</c:if>
                </form>
            </div>
        </div>

	    <div class="jqGrid_wrapper">
	        <div id="jqGrid_operation" class="jg-grid">
	            <div class="jqGrid_operation" id="action"></div>
	        </div>
	        <table id="jqGrid"></table>
	        <div id="jqGrid_paper"></div>
	    </div>
    </div>
</div>
<script>
    $(document).ready(
            function () {
                var flag = true;
            	$.ajax({
                    type: "POST",
                    async: false,
                    url: '/admin/auth_menusAll.action',
                    data: "url=" + window.location.pathname,
                    success: function (data) {
                        data = eval("(" + data + ")");
                        for (var i in data) {
                            var action = data[i].mName;
                            switch (action) {
                                case "发钥匙":
                                	if('${userRole}'==1  || '${userRole}'==5 || '${userRole}'==6){
                                    $("#jqGrid_operation").append("<a style=\"display:none;border-bottom:1px solid #337ab7;margin-left: 14px;font-size: 16px;\" href=\"javascript:;\" onclick=\"javascript:post(\'${pageContext.request.contextPath}/admin/tusers_authorizeKeysView.action\',{communityId:\'${communityIdA}\',agtCode:\'${agtCodeA}\'})\">授权钥匙</a>");
                                    break;
                                	}
                                case "楼栋管理":
                                	if(flag){
                                	if('${userRole}'==1  || '${userRole}'==5 || '${userRole}'==6){
	                                    $("#jqGrid_operation").append("<a style=\"border-bottom:1px solid #337ab7;margin-left: 14px;font-size: 16px;\" href=\"javascript:;\" onclick=\"javascript:post(\'${pageContext.request.contextPath}/admin/cinstallunit_listViewV2.action\',{communityId:\'${communityIdA}\'})\">楼栋管理</a>");
                                     }	
                                	flag = false;
                                    break;
                            }
                            }
                        }
                    }
                });
                $("#utype").select2({
                	"placeholder": "请选择状态",
	                "minimumResultsForSearch":-1
                })
            	$.ajax({
                    type: "POST",
                    async: false,
                    url: '/admin/auth_buttons.action',
                    data: "url=" + window.location.pathname,
                    success: function (data) {
                        data = eval("(" + data + ")");
                        for (var i in data) {
                            var action = data[i].mName;
                            switch (action) {
                                case "住户删除":
                                    $("#action").append("<a id=\"del\"><i class=\"glyphicon glyphicon-trash\"></i>删除</a>");
                                    $("#del").click(function () {
                                        var sels = jQuery("#jqGrid").jqGrid('getGridParam', 'selarrrow');
                                        if (sels == "") {
                                            layer.alert("请选择要删除的记录", {
                                                icon: 6,
                                                closeBtn: false
                                            });
                                        } else {
                                            layer.confirm('确认删除所选择的记录', function (index) {
                                                $.post("${pageContext.request.contextPath}/admin/tusers_delete.action", {
                                                    "ids": sels.toString()
                                                }, function (result) {
                                                    result = eval("(" + result + ")");
                                                    layer.alert(result.msg);
                                                    refreshGrid();
                                                });
                                                layer.close(index);
                                            });
                                        }
                                    });
                                    break;
                                case "住户审核":
                                	if('${userRole}'==1  || '${userRole}'==5 || '${userRole}'==6){
                                    $("#jqGrid_operation").append("<a style=\"border-bottom:1px solid #337ab7;margin-left: 14px;font-size: 16px;\" href=\"javascript:;\" onclick=\"javascript:post(\'${pageContext.request.contextPath}/admin/tusers_auditListView.action\',{communityId:\'${communityIdA}\',agtCode:\'${agtCodeA}\'})\">审核住户</a>");
                                	}
                                    break;
                            }
                        }
                    }
                });

                $.jgrid.defaults.styleUI = "Bootstrap";
                if('${rLevel}'==3 || '${rLevel}'==4){
                	$("#jqGrid").jqGrid(
                            {
                                url: "${pageContext.request.contextPath}/admin/tusers_page.action?communityId=${communityId}",
                                mtype: 'POST',
                                datatype: "json",
                                height: 350,
                                autowidth: true,
                                shrinkToFit: true,
                                rowNum: 10,
                                rowList: [10, 20, 30],
                                colNames: ['序号', '所属区域', '公司', '主用户', '姓名','昵称', '手机号'],
                                colModel: [{
                                    name: "SID",
                                    index: "SID",
                                    key: true,
                                    hidden: true
                                }, {
                                    name: 'CITYCODE',
                                    index: 'CITYCODE'
                                }, {
                                    name: 'AGTNAME',
                                    index: 'AGTNAME'
                                }, {
                                    name: 'COMMUNITYNAME',
                                    index: 'COMMUNITYNAME'
                                }, {
                                    name: 'AUNAME',
                                    index: 'AUNAME',
                                    formatter: function (cellvalue, options, rawObject) {
                                        if(!cellvalue){
                                        	return ''
                                        }else{
                                    		return '<a style="border-bottom:1px solid #337ab7;" href="javascript:;" onclick="javascript:post(\'${pageContext.request.contextPath}/admin/tusers_userDetail2.action\',{userId:\''+rawObject.USERID+'\'})">'+cellvalue+'</a>';
                                        }
                                    }
                                }, {
                                    name: 'NICKNAME',
                                    index: 'NICKNAME'
                                }, {
                                    name: 'TEL',
                                    index: 'TEL'
                                }],
                                sortname: 'sid',
                                sortorder:'desc',
                                rownumbers: true,
                                jsonReader: {
                                    root: 'rows',
                                    page: "page",
                                    total: 'total',
                                    records: "records",
                                    repeatitems: false
                                },
                                pager: "#jqGrid_paper",
                                viewrecords: true,
                                multiselect: false,
                                hidegrid: false,
                                loadComplete: function(){
                            		var re_records = Number($("#jqGrid").getGridParam('records'));
                            		var page = Number($("#jqGrid").getGridParam('page'));
                            		var rows=Number($("#jqGrid").getGridParam('rowNum'));
                            		var num = re_records-(page-1)*rows;
                            		if(num < rows)
                            		{
                            			for(var i=num;i<rows;i++){
                            				$("#jqGrid").jqGrid("addRowData",(i+1),
                                    				{ "SID":"", "CITYCODE":"", "AGTNAME":"", "COMMUNITYNAME":"", "CBUNAME":"","AUNAME":"","TEL":"","BANNERNUM":"-1","DD":"-1","DDJE":"-1","UALNUM":"-1"}
                            				,"");
                            			}
                            			$(".ui-paging-info").html(re_records-num+1 +" - "+re_records+"　共 "+re_records+" 条");
                            		}
//                             		if('${rLevel}'==3 || '${rLevel}'==4){
//     	                        		jQuery("#jqGrid").setGridParam().hideCol(["CBUNAME","BANNERNUM","DD","DDJE","UALNUM"]).trigger("reloadGrid");
//                                 	}
                            	}
                            });
                }else{
                	$("#jqGrid").jqGrid(
                            {
                                url: "${pageContext.request.contextPath}/admin/tusers_page.action?communityId=${communityId}",
                                mtype: 'POST',
                                datatype: "json",
                                height: 350,
                                autowidth: true,
                                shrinkToFit: true,
                                rowNum: 10,
                                rowList: [10, 20, 30],
                                colNames: ['序号', '所属区域', '小区名称', '楼栋单元房间号', '姓名', '状态', '昵称', '手机号'],
                                colModel: [{
                                    name: "SID",
                                    index: "SID",
                                    key: true,
                                    hidden: true
                                }, {
                                    name: 'CITYCODE',
                                    index: 'CITYCODE'
                                },{
                                    name: 'COMMUNITYNAME',
                                    index: 'COMMUNITYNAME'
                                }, {
                                    name: 'CBUNAME',
                                    index: 'CBUNAME'
                                }, {
                                    name: 'AUNAME',
                                    index: 'AUNAME',
                                    formatter: function (cellvalue, options, rawObject) {
                                        if(!cellvalue){
                                        	return ''
                                        }else{
                                    		return '<a style="border-bottom:1px solid #337ab7;" href="javascript:;" onclick="javascript:post(\'${pageContext.request.contextPath}/admin/tusers_userDetail.action\',{userId:\''+rawObject.USERID+'\'})">'+cellvalue+'</a>';
                                        }
                                    }
                                },{
                                    name: 'UTYPE',
                                    index: 'UTYPE'
                                }, {
                                    name: 'NICKNAME',
                                    index: 'NICKNAME'
                                }, {
                                    name: 'TEL',
                                    index: 'TEL'
                                }],
                                sortname: 'sid',
                                sortorder:'desc',
                                rownumbers: true,
                                jsonReader: {
                                    root: 'rows',
                                    page: "page",
                                    total: 'total',
                                    records: "records",
                                    repeatitems: false
                                },
                                pager: "#jqGrid_paper",
                                viewrecords: true,
                                multiselect: true,
                                hidegrid: false,
                                loadComplete: function(){
                            		var re_records = Number($("#jqGrid").getGridParam('records'));
                            		var page = Number($("#jqGrid").getGridParam('page'));
                            		var rows=Number($("#jqGrid").getGridParam('rowNum'));
                            		var num = re_records-(page-1)*rows;
                            		if(num < rows)
                            		{
                            			for(var i=num;i<rows;i++){
                            				$("#jqGrid").jqGrid("addRowData",(i+1),
                                    				{ "SID":"", "CITYCODE":"", "AGTNAME":"", "COMMUNITYNAME":"", "CBUNAME":"","AUNAME":"","TEL":""}
                            				,"");
                            			}
                            			$(".ui-paging-info").html(re_records-num+1 +" - "+re_records+"　共 "+re_records+" 条");
                            		}
//                             		if('${rLevel}'==3 || '${rLevel}'==4){
//     	                        		jQuery("#jqGrid").setGridParam().hideCol(["CBUNAME","BANNERNUM","DD","DDJE","UALNUM"]).trigger("reloadGrid");
//                                 	}
                            	}
                            });
                }
                
                
                if('${userRole}' == '1' || '${userRole}' == '2' || '${userRole}' == '21'){
	                $.post("${pageContext.request.contextPath}/admin/tagent_list.action", function (data) {
			            $("#agtCode").empty();
			            $("#agtCode").append("<option value=''>请选择公司</option>");
			            for (var i = 0; i < data.length; i++) {
			                $("#agtCode").append("<option value='" + data[i].agtCode + "'>" + data[i].agtName + "</option>");
			            }
			            $("#agtCode").select2({
			                "placeholder": "请选择公司"
			            })
			            $("#agtCode").change(function () {
			            	var data = $(this).val();
			            	$.post("${pageContext.request.contextPath}/admin/tcommunity_list.action", {"agtCode": data},function (data) {
					            $("#communityId").empty();
					            $("#communityId").append("<option value=''>请选择社区</option>");
					            for (var i = 0; i < data.length; i++) {
					                $("#communityId").append("<option value='" + data[i].sid + "'>" + data[i].communityName + "</option>");
					            }
					            $("#communityId").select2({
					                "placeholder": "请选择社区"
					            })
					        }, "json");
			            })
			        }, "json");
                }else if('${userRole}' == '3' || '${userRole}' == '4' ){
                	$.post("${pageContext.request.contextPath}/admin/tcommunity_list.action", 
                        function (data) {
			            $("#communityId").empty();
			            if('${rLevel}'==3 || '${rLevel}'==4){
			            	$("#communityId").append("<option value=''>请选择客户</option>");
				        }else{
			            	$("#communityId").append("<option value=''>请选择社区</option>");
					    }
			            for (var i = 0; i < data.length; i++) {
			                $("#communityId").append("<option value='" + data[i].sid + "'>" + data[i].communityName + "</option>");
			            }
			            if('${rLevel}'==3 || '${rLevel}'==4){
				            $("#communityId").select2({
				                "placeholder": "请选择客户"
				            })
				        }else{
				            $("#communityId").select2({
				                "placeholder": "请选择小区"
				            })
					    }
			        }, "json");
                }
                
                <!--查询-->
                jQuery("#query").click(query);
                jQuery("#resetForm").click(resetForm);
                if('${userRole}' == '1' || '${userRole}' == '2' || '${userRole}' == '21'|| '${userRole}' == '5' || '${userRole}' == '6'){
                    $.post("${pageContext.request.contextPath}/admin/cbuilding_list.action",{"communityId": '${communityId}'},function (data) {
                        $("#cBuildingId").empty();
                        $("#cBuildingId").append("<option value=''>请选择楼栋</option>");
                        for (var i = 0; i < data.length; i++) {
                            $("#cBuildingId").append("<option value='" + data[i].sid + "'>" + data[i].cbName + "</option>");
                        }
                       
                         $("#cBuildingId").change(function () {
                           	var data = $(this).val();
                           	$.post("${pageContext.request.contextPath}/admin/cinstallunit_listUnit.action", {"bsid": data},function (data) {
                	            $("#unitId").empty();
                	            $("#unitId").append("<option value=''>请选择单元</option>");
                	           
                	            for (var i = 0; i < data.length; i++) {
                	                $("#unitId").append("<option value='"+data[i].SID+"'>"+data[i].CBNAME+"</option>");
                	            }
                	        }, "json");
                           })
                    }, "json");
	
                }

            });
    $("#cBuildingId").select2({
        "placeholder": "请选择楼栋",
        "minimumResultsForSearch":-1
    })
     $("#communityId").select2({
        "placeholder": "请选择小区",
        "minimumResultsForSearch":-1
    })
     $("#unitId").select2({
         "placeholder": "请选择单元",
         "minimumResultsForSearch":-1
            })
    <!--刷新jqGrid表格数据-->
    function refreshGrid() {
        $("#jqGrid").trigger("reloadGrid");
    }
    function query() {
        var $agtCode = $("#agtCode").val();
        var $communityId = $("#communityId").val();
        var $areaCode;
		if('${userRole}' != 5 && '${userRole}' != 6){
	        var selects=document.getElementsByName('location');
	        $areaCode = selects[0].value;
		}
        var $auName = $("#auName").val();
        var $nickName = $("#nickName").val();
        var $auTel = $("#auTel").val();
        var cBuildingId= $("#cBuildingId").val();
        var unitId = $("#unitId").val();
        var roomNo = $("#roomNo").val();
        var utype = $("#utype").val();
        $("#jqGrid").jqGrid('setGridParam', {
            url: "${pageContext.request.contextPath}/admin/tusers_page.action",
            postData: {
                'agtCode': $agtCode,
                'communityId': $communityId,
                'areaCode': $areaCode,
                'auName': $auName,
                'nickName': $nickName,
                'auTel': $auTel,
                'cBuildingId': cBuildingId,
                'unitId': unitId,
                'roomNo': roomNo,
                'utype': utype
            }, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入*/
        return false;
    }
    function resetForm() {
        location.reload();
        return false;
    }
    function post(url,params) {
    	var temp = document.createElement("form");
    	temp.action = url;
    	temp.method = "post";
    	temp.style.display = "none";
    	for (var x in params) {
    	var opt = document.createElement("textarea");
    	opt.name = x;
    	opt.value = params[x];
    	temp.appendChild(opt);
    	}
    	document.body.appendChild(temp);
    	temp.submit();
    	return temp;
    };
	window.onload=function(){
		
		function BrowserType(){
			//获取浏览器的userAgent代理号；
			var userAgent=navigator.userAgent;
			
			//判断是否是Opera浏览器
			var isOpera=userAgent.indexOf("Opera")>-1;
			//判断是否是IE浏览器
			var isIE=userAgent.indexOf("compatible")>-1 && userAgent.indexOf("MSIE")>-1 && !isOpera;
			//判断是否是IE7浏览器
			if(isIE){
				var relIE=new RegExp("MSIE(\\d+\\.\\d+);");
				
				relIE.test(userAgent);
				var arr=userAgent.split(";")
				var flEVersion=arr[1].indexOf("7");
				if(flEVersion>-1){
					var $td=$(".jqgrid-rownum")[0];
					$td.style.width="0";
					$tr=$("thead tr th");
					$td=$("tbody tr td");
					var len=$tr.length;
					for(var i=0;i<len;i++){
						$tr[i].style.width=10+"px";
						$td[i].style.width=10+"px";
					};
					console.log("IE7");
				}
			}
		};
		BrowserType();
	};
</script>
</body>
</html>
